package com.example.demo.model.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;

@Entity
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "t_user")
public class User {

    public static final int USER = 0;
    public static final int ADMIN = 1;

    @Id
    private String userName;

    @Column
    @JsonIgnore
    private String passWord;

    @Column
    @JsonIgnore
    private int role;



    public void register(String userName, String passWord) {
        this.setUserName(userName);
        this.setPassWord(passWord);
        this.setRole(USER);
    }

}

